<!DOCTYPE html>
<html>
<head>
    <title>DeepSeek API Demo</title>
</head>
<body>
    <div id="chat">
        <input type="text" id="input" placeholder="输入你的问题..." />
        <button onclick="sendRequest()">发送</button>
        <div id="response"></div>
    </div>

    <script>
        async function sendRequest() {
            const input = document.getElementById('input').value;
            const responseElement = document.getElementById('response');
            
            try {
                // 调用后端接口（替换为你的后端URL）
                const res = await fetch('http://localhost:2989/api/deepseek', {
                    method: 'POST',
                    headers: { 'Content-Type': 'application/json' },
                    body: JSON.stringify({ prompt: input })
                });
                
                const data = await res.json();
                responseElement.innerHTML = data.response;
            } catch (error) {
                responseElement.innerHTML = "请求出错，请重试。";
            }
        }
    </script>
</body>
</html>